package com.thrd.taiexhibition.model;

import com.alibaba.fastjson.JSON;
import com.thrd.basicframework.http.OkHttpUtils;
import com.thrd.basicframework.http.callback.ThrdCallBack;
import com.thrd.taiexhibition.bean.BeanThemeHome;
import com.thrd.taiexhibition.callback.MvpCallback;
import com.thrd.taiexhibition.utils.Constant;

/**
 * @author: ${唐杰}
 * @date: 2021/3/23
 */
public class ThemeExhibitonModel {

    public static final String TAG="ThemeExhibitonModel";


    /**
     * 获取城市首页
     */
    public void getThemeExhibitonData(String id,final MvpCallback<BeanThemeHome> mvpCallback) {
        OkHttpUtils.post().url(Constant.HTTP_THEME_EXHIBITION)
                .tag(TAG)
                .addParams("cityId", id)
                .build().execute(new ThrdCallBack<BeanThemeHome>() {
            @Override
            public void onFailed(String e, int code) {
                mvpCallback.onFailed(e, code);
            }

            @Override
            public void onResponse(BeanThemeHome response, int id) {
                mvpCallback.onSuccess(response);
            }

            @Override
            public BeanThemeHome onJson(String s) {
                return JSON.parseObject(s, BeanThemeHome.class);
            }


        });
    }
}
